package com.yonyougov.devops.cruxcisupport.rolemenu;

import com.yonyougov.devops.cruxcisupport.rolemenu.vo.RoleMenuPageLikeDto;
import com.yonyougov.devops.cruxcisupport.rolemenu.vo.RoleMenuPageLikeVo;
import com.yonyougov.devops.fwc.core.dao.impl.BaseDaoImpl;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Repository;

import java.math.BigInteger;
import java.util.List;

/**
 * t_role_menu数据层实现
 */
@Repository
public class RoleMenuDaoImpl extends BaseDaoImpl<RoleMenuEntity, BigInteger> implements RoleMenuDao {


    //<!--用户自定义代码开始-->
    private final SqlSessionTemplate sqlSessionTemplate;

    public RoleMenuDaoImpl(SqlSessionTemplate sqlSessionTemplate) {
        this.sqlSessionTemplate = sqlSessionTemplate;
    }

    @Override
    public List<RoleMenuPageLikeVo> findRoleMenuPageLike(RoleMenuPageLikeDto roleMenuPageLikeDto) {
        String statement = RoleMenuEntity.class.getName() + "Mapper.findRoleMenuPageLIke";
        return sqlSessionTemplate.selectList(statement, roleMenuPageLikeDto);
    }

    @Override
    public int countByLikeRoleMenu(RoleMenuPageLikeDto roleMenuPageLikeDto) {
        String statement = RoleMenuEntity.class.getName() + "Mapper.countByLikeRoleMenu";
        return sqlSessionTemplate.selectOne(statement, roleMenuPageLikeDto);
    }

    @Override
    public void addBatch(List<RoleMenuEntity> roleMenuEntityList) {
        String statement = RoleMenuEntity.class.getName() + "Mapper.addBatch";
        sqlSessionTemplate.insert(statement, roleMenuEntityList);
    }

    @Override
    public void deleteBatchRoleMenuByIds(List<BigInteger> ids) {
        String statement = RoleMenuEntity.class.getName() + "Mapper.deleteBatchRoleMenuByIds";
        sqlSessionTemplate.insert(statement, ids);
    }

    //<!--用户自定义代码结束-->
}
